const debug = require("debug");
const path = require("path");
debug.enable("test123");
const isYarn = path
  .basename(process.env.npm_execpath || "npm")
  .startsWith("yarn");

module.exports = {
  createLogger(name) {
    const logger = debug(name);
    if (!logger.enabled) {
      const prev = debug.disable();
      debug.enable(`${prev};${name}`);
    }
    return logger;
  },
  isYarn,
  runner: isYarn ? "yarn" : "npm",
};
